﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using Pahan.McuFusion.Common.Utils;
using Pahan.McuFusion.UI.Presenters;
using Pahan.McuFusion.UI.Views;

namespace Pahan.McuFusion.UI
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        private static void Main(String[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ApplicationExit += OnApplicationExit;
            AssemblyLoader.LoadAll(Path.Combine(Application.StartupPath, "Extensions"));
            var mainView = new MainView();
            mainViewPresenter = new MainViewPresenter(mainView, args);
            Application.Run(mainView);
        }

        private static void OnApplicationExit(object sender, EventArgs e)
        {
            mainViewPresenter.Dispose();
        }

        private static MainViewPresenter mainViewPresenter;
    }
}
